/*
//====================创建历史====================
//文件名称：layer.js
//创 建 者：徐晶
//创建时间：2009-09-18
//功能描述：层控件
//====================修改历史====================
//修改时间：
//修 改 者：
//修改内容：
//================================================

//方法列表
//画大表格
//data	大类数据
	pt.createLayer = function( data )
//画小表格
//data	小类数据
//td		上层td
	pt.createSubLayer = function( data , td )

//填充已选区域
	pt.fillSelectedOption = function()
//取消已选选项
//code	取消的编号
	pt.unchkSelectedOption = function( code )
	
//填充大类
	pt.fillLayer = function()
//显示大类
	pt.showLayer = function()
//大类点击
	pt.clickLayer = function( bigcode , td )

//填充小类
//subclass	小类数据
	pt.fillSubLayer = function( subclass )
//显示小类
//td	定位的td
	pt.showSubLayer = function( td )
//小类点击
//code	小类编号
//td		点击的td
	pt.clickSubLayer = function( code , td )

//清空
	pt.clearSelect = function()
//确定
	pt.confirmSelect
//关闭
	pt.hideLayer = function()

//标示子层
	pt.setSubLayerOpen = function()
//关闭子层
	pt.setSubLayerClose = function()
//延时查看是否该关闭
	pt.hideSubLayer = function()

//从选项中删除某个选项
//code	需要删除的编号
	pt.removeSelectedOption = function( code )
//获取子类数据
//data			子类json
//bigcode		大类编号
	pt.getSubData = function( data , bigcode )
//获取数据字典内容
//code	编号
	pt.getLayerValue = function( code )
//阻止事件冒泡
//chkbox	控件
	pt.returnChx = function( chkbox )

//参数列表
NeedSubLayer
MaxNumber
RowNumber

TitleBarClassName
TdTitleBarTitleClassName
TdTitleBarClearClassName
TdTitleBarCloseClassName

TitleBarStr
SpanTitleBarTitleClassName
ClearStr
SpanTitleBarClearClassName
CloseStr
SpanTitleBarCloseClassName

LayerClassName
LayerTdClassName

ContainerClassName
SubContainerClassName

BlankStr

levelalign
verticalalign

openNode
valueNode
appendNode
showNode
*/
(function(){
	var Layer = window.Layer = function(p_jsnData,p_jsnPara){
		/* 数据处理开始 */
		p_jsnData=p_jsnData instanceof Object?p_jsnData:{};
		if(!p_jsnData){
			return;
		}
		this._arrPrivate['arrLayerData']={};
		this._arrPrivate['arrLayerData'].bigclass=p_jsnData.bigclass?p_jsnData.bigclass:p_jsnData;
		p_jsnData.subclass?this._arrPrivate['arrLayerData'].subclass=p_jsnData.subclass:'';
		p_jsnData=null;
		/* 数据处理结束 */
		/* 配置初始化开始 */
		this._arrPrivate['arrLayerConfig']=p_jsnPara instanceof Object?p_jsnPara:{};
		p_jsnPara=null;
		this._arrPrivate['arrLayerConfig'].BigClassCodeLength=this._arrPrivate['arrLayerConfig'].BigClassCodeLength?this._arrPrivate['arrLayerConfig'].BigClassCodeLength:8;
		this._arrPrivate['arrLayerConfig'].SubClassCodeLength=this._arrPrivate['arrLayerConfig'].SubClassCodeLength?this._arrPrivate['arrLayerConfig'].SubClassCodeLength:8;
		this._arrPrivate['arrLayerConfig'].NeedSubLayer=this._arrPrivate['arrLayerConfig'].NeedSubLayer?true:false;// 是否两层结构
		this._arrPrivate['arrLayerConfig'].MaxNumber=this._arrPrivate['arrLayerConfig'].MaxNumber?this._arrPrivate['arrLayerConfig'].MaxNumber:1;// 多选时的最多选项，如果不配置则为单选
		this._arrPrivate['arrLayerConfig'].IsMulti=1==this._arrPrivate['arrLayerConfig'].MaxNumber?false:true;
		this._arrPrivate['arrLayerConfig'].RowNumber=Math.max(this._arrPrivate['arrLayerConfig'].MaxNumber+1,this._arrPrivate['arrLayerConfig'].RowNumber?this._arrPrivate['arrLayerConfig'].RowNumber:5);// 每行显示数量，为了多选时已选选项显示排版好看，每行至少要显示MaxNumber+1个选项
		this._arrPrivate['arrLayerConfig'].SubstrLength=this._arrPrivate['arrLayerConfig'].SubstrLength?this._arrPrivate['arrLayerConfig'].SubstrLength:'';// 截取字符串长度
		this._arrPrivate['arrLayerConfig'].ValueSep=this._arrPrivate['arrLayerConfig'].ValueSep?this._arrPrivate['arrLayerConfig'].ValueSep:',';// 值分隔符
		this._arrPrivate['arrLayerConfig'].ViewSep=this._arrPrivate['arrLayerConfig'].ViewSep?this._arrPrivate['arrLayerConfig'].ViewSep:',';// 字符分隔符
		this._arrPrivate['arrLayerConfig'].SelectBig=this._arrPrivate['arrLayerConfig'].SelectBig==false?this._arrPrivate['arrLayerConfig'].SelectBig:true;// 是否能够选择大类
		this._arrPrivate['arrLayerSelOpt']=[];// 选择的CODE
		/* 配置初始化结束 */
	
		/* 标题部分开始 */
		var TitleBar=document.createElement('table');
		TitleBar.className=this._arrPrivate['arrLayerConfig'].TitleBarClassName?this._arrPrivate['arrLayerConfig'].TitleBarClassName:'titlebar';
		var TitleBarTr=TitleBar.insertRow(0);
		var TdTitleBarTitle=TitleBarTr.insertCell(0);
		TdTitleBarTitle.className=this._arrPrivate['arrLayerConfig'].TdTitleBarTitleClassName?this._arrPrivate['arrLayerConfig'].TdTitleBarTitleClassName:'tdtitlebartitle';
		var TdTitleBarCfm=TitleBarTr.insertCell(1);
		TdTitleBarCfm.className=this._arrPrivate['arrLayerConfig'].TdTitleBarCfmClassName?this._arrPrivate['arrLayerConfig'].TdTitleBarCfmClassName:'tdtitlebarcfm';
		var TdTitleBarClear=TitleBarTr.insertCell(2);
		TdTitleBarClear.className=this._arrPrivate['arrLayerConfig'].TdTitleBarClearClassName?this._arrPrivate['arrLayerConfig'].TdTitleBarClearClassName:'tdtitlebarclear';
		var TdTitleBarClose=TitleBarTr.insertCell(3);
		TdTitleBarClose.className=this._arrPrivate['arrLayerConfig'].TdTitleBarCloseClassName?this._arrPrivate['arrLayerConfig'].TdTitleBarCloseClassName:'tdtitlebarclose';
	
		var SpanTitleBarTitle=document.createElement('span');
		this._arrPrivate['arrLayerConfig'].TitleBarStr?SpanTitleBarTitle.innerHTML=this._arrPrivate['arrLayerConfig'].TitleBarStr:'';
		SpanTitleBarTitle.className=this._arrPrivate['arrLayerConfig'].SpanTitleBarTitleClassName?this._arrPrivate['arrLayerConfig'].SpanTitleBarTitleClassName:'spantitlebartitle';
		TdTitleBarTitle.appendChild(SpanTitleBarTitle);
	
		if(this._arrPrivate['arrLayerConfig'].IsMulti){
			var SpanTitleBarCfm=document.createElement('span');
			SpanTitleBarCfm.innerHTML=this._arrPrivate['arrLayerConfig'].CfmStr?this._arrPrivate['arrLayerConfig'].CfmStr:'确定';
			SpanTitleBarCfm.className=this._arrPrivate['arrLayerConfig'].SpanTitleBarCfmClassName?this._arrPrivate['arrLayerConfig'].SpanTitleBarCfmClassName:'spantitlebarcfm';
			TdTitleBarCfm.appendChild(SpanTitleBarCfm);
		}
	
		var SpanTitleBarClear=document.createElement('span');
		SpanTitleBarClear.innerHTML=this._arrPrivate['arrLayerConfig'].ClearStr?this._arrPrivate['arrLayerConfig'].ClearStr:'清除';
		SpanTitleBarClear.className=this._arrPrivate['arrLayerConfig'].SpanTitleBarClearClassName?this._arrPrivate['arrLayerConfig'].SpanTitleBarClearClassName:'spantitlebarclear';
		TdTitleBarClear.appendChild(SpanTitleBarClear);
	
		var SpanTitleBarClose=document.createElement('span');
		SpanTitleBarClose.innerHTML=this._arrPrivate['arrLayerConfig'].CloseStr?this._arrPrivate['arrLayerConfig'].CloseStr:'关闭';
		SpanTitleBarClose.className=this._arrPrivate['arrLayerConfig'].SpanTitleBarCloseClassName?this._arrPrivate['arrLayerConfig'].SpanTitleBarCloseClassName:'spantitlebarclose';
		TdTitleBarClose.appendChild(SpanTitleBarClose);
		/* 标题部分结束 */
		var Layer=this.createLayer(this._arrPrivate['arrLayerData'].bigclass);// 创建大类层
		/* 层显示开始 */
	
		this._arrPrivate['divLayerContainer']=document.createElement('div');// 定位层
		this._arrPrivate['arrLayerConfig'].LayerID?this._arrPrivate['divLayerContainer'].id=this._arrPrivate['arrLayerConfig'].LayerID:'';
		this._arrPrivate['divLayerContainer'].className=this._arrPrivate['arrLayerConfig'].ContainerClassName?this._arrPrivate['arrLayerConfig'].ContainerClassName:'laycontainer';
		this.appendEle(this._arrPrivate['divLayerContainer'],TitleBar);
		this.appendEle(this._arrPrivate['divLayerContainer'],Layer);
		this.appendEle(this._arrPrivate['arrLayerConfig'].appendNode?this._arrPrivate['arrLayerConfig'].appendNode:document.body,this._arrPrivate['divLayerContainer']);
		/* 层显示结束 */
		/* 初始化数据开始 */
		if(this._arrPrivate['arrLayerConfig'].valueNode?this._arrPrivate['arrLayerConfig'].valueNode.value:''){
			eval('var strtmp = [\''+this._arrPrivate['arrLayerConfig'].valueNode.value.replace(/,/g,'\',\'')+'\'];');
			for( var i=0;i<strtmp.length;++i){
				this._arrPrivate['arrLayerSelOpt'].push(strtmp[i]);
			}
			this.confirmSelect();
		}
		this.fillSelectedOption();
		this.fillLayer();
		/* 初始化数据结束 */
		/* 绑定事件开始 */
		this._arrPrivate['arrLayerConfig'].openNode?this.bindEvent(this._arrPrivate['arrLayerConfig'].openNode,'click',this.getFunc(this,this.showLayer)):'';
		this.bindEvent(SpanTitleBarClose,'click',this.getFunc(this,this.hideLayer));
		this._arrPrivate['arrLayerConfig'].viewNode?this.bindEvent(SpanTitleBarClear,'click',this.getFunc(this,this.clearSelect)):'';
		if(this._arrPrivate['arrLayerConfig'].IsMulti){
			this._arrPrivate['arrLayerConfig'].viewNode?this.bindEvent(SpanTitleBarCfm,'click',this.getFunc(this,this.confirmSelect)):'';
		}
		/* 绑定事件结束 */
	}.extend( Base ),
	pt = Layer.prototype;
	//画大表格
	//data	大类数据
	pt.createLayer = function( data ){
		var Layer = document.createElement( 'table' );
		var rowNumber = this.p.IsMulti ?  Math.min( this.p.RowNumber , this.getJLength( data ) + 1 ) : Math.min( this.p.RowNumber , this.getJLength( data ) );
		Layer.className = this.p.LayerClassName ? this.p.LayerClassName : 'layer';
		this._SelTd = [];
		if( this.p.IsMulti ){
			var SelectedTr = Layer.insertRow( 0 );
			var SelecteTd1 = SelectedTr.insertCell( 0 );
			SelecteTd1.innerHTML = this.p.ChoosenStr ? this.p.ChoosenStr : '已选择：';
			SelecteTd1.className = this.p.ChoosenTdClassName ? this.p.ChoosenTdClassName : 'choosentd';
			for( var i = 0 ; i < rowNumber - 1 ; ++i ){
				this._SelTd.push( SelectedTr.insertCell( SelectedTr.cells.length ) );
				this._SelTd[i].className = this.p.LayerTdClassName ? this.p.LayerTdClassName : 'layertd';
			}
		}
		i = 0;
		Layer.td = [];
		for( var k in data ){
			if( 0 == i % rowNumber ){
				Layer.insertRow( Layer.rows.length );
			}
			Layer.td.push( Layer.rows[Layer.rows.length-1].insertCell( Layer.rows[Layer.rows.length-1].cells.length ) );
			Layer.td[i].className = this.p.LayerTdClassName ? this.p.LayerTdClassName : 'layertd';
			this.setProps( Layer.td[i] , {style:{width: 100 / rowNumber + '%'}} );
			++i;
		}
		for(; i < rowNumber ; ++i ){//补充最后的表格
			if( 0 == i % rowNumber ){ break; }
			Layer.td.push( Layer.rows[Layer.rows.length-1].insertCell( i % rowNumber ) );
			Layer.td[i].innerHTML = this.p.BlankStr ? this.p.BlankStr : '&nbsp;';
			Layer.td[i].className = this.p.LayerTdClassName ? this.p.LayerTdClassName : 'layertd';
		}
		return Layer;
	};
	//画小表格
	//data	小类数据
	//td		上层td
	pt.createSubLayer = function( data , td ){
		var Layer = document.createElement( 'table' );
		var rowNumber = Math.min( this.p.RowNumber , this.getJLength( data ) );
		Layer.className = this.p.LayerClassName ? this.p.LayerClassName : 'layer';
		var i = 0;
		Layer.td = [];
		for( var k in data ){
			if( 0 == i % rowNumber ){
				Layer.insertRow( Layer.rows.length );
			}
			Layer.td.push( Layer.rows[Layer.rows.length-1].insertCell( Layer.rows[Layer.rows.length-1].cells.length ) );
			Layer.td[i].className = this.p.LayerTdClassName ? this.p.LayerTdClassName : 'layertd';
			this.setProps( Layer.td[i] , {style:{width:(this.getStyle( td , 'width' ).substr( 0 , this.getStyle( td , 'width' ).length - 1 ) * this.getStyle( this.Container , 'width' ).substr( 0 , this.getStyle( this.Container , 'width' ).length -2 ) / 100) + 'px'}} );
			++i;
		}
		for(; i < rowNumber ; ++i ){//补充最后的表格
			if( 0 == i % rowNumber ){ break; }
			Layer.td.push( Layer.rows[Math.floor( i / rowNumber )].insertCell( i % rowNumber ) );
			Layer.td[i].innerHTML = this.p.BlankStr ? this.p.BlankStr : '&nbsp;';
			Layer.td[i].className = this.p.LayerTdClassName ? this.p.LayerTdClassName : 'layertd';
		}
		return Layer;
	};
	
	//填充已选区域
	pt.fillSelectedOption = function(){
		for( var i = 0 ; i < this._SelTd.length ; ++i ){
			this.emptyEle( this._SelTd[i] );
			this._SelTd[i].removeAttribute( 'title' );
			this._SelTd[i].clickfunc ? this.removeEvent( this._SelTd[i] , 'click' , this._SelTd[i].clickfunc ) : '';
			if( this._SelOpt[i] ){
				var chx = document.createElement( 'input' );
				chx.type = 'checkbox';
				chx.value = this._SelOpt[i];
				chx.onclick = this.getFunc( this , this.returnChx , chx );
				chx.className = this.p.ChkboxClassName ? this.p.ChkboxClassName : 'chxbox';
				var txt;
				if( this.p.SubstrLength ){
					txt = document.createTextNode( this.getLayerValue( this._SelOpt[i] ).substringPro( this.p.SubstrLength ) );
				}else{
					txt = document.createTextNode( this.getLayerValue( this._SelOpt[i] ) );
				}
				this._SelTd[i].title = this.getLayerValue( this._SelOpt[i] );
				this._SelTd[i].appendChild( chx );
				this._SelTd[i].appendChild( txt );
				this.bindEvent( this._SelTd[i] , 'click' , this._SelTd[i].clickfunc = this.getFunc( this , this.unchkSelectedOption , this._SelOpt[i] ) );
				chx.checked = true;
			}
		}
	};
	//取消已选选项
	//code	取消的编号
	pt.unchkSelectedOption = function( code ){
		this.SelectedOption = this.removeSelectedOption( code );
		this.fillSelectedOption();
		this.fillLayer();
		return '';
	};
	//填充大类
	pt.fillLayer = function(){
		var tds = this.Container.childNodes[1].td;
		for( var i = 0 ; i < tds.length ; ++i ){
			this.emptyEle( tds[i] );
			tds[i].removeAttribute( 'title' );
			tds[i].clickfunc ? this.removeEvent( tds[i] , 'click' , tds[i].clickfunc ) : '';
		}
		i = 0;
		for( var k in this.d.bigclass ){
			if( this.p.IsMulti && !this.p.NeedSubLayer ){
				var chx = document.createElement( 'input' );
				chx.type = 'checkbox';
				chx.value = k;
				chx.onclick = this.getFunc( this , this.returnChx , chx );
				chx.className = this.p.ChkboxClassName ? this.p.ChkboxClassName : 'chxbox';
				tds[i].appendChild( chx );
				for( var m = 0 ; m < this._SelOpt.length ; ++m ){
					if( this._SelOpt[m] == k ){
						chx.checked = true;
						break;
					}
				}
			}
			if( this.p.SubstrLength ){
				var txt = document.createTextNode( this.d.bigclass[k].substringPro( this.p.SubstrLength ) );
			}else{
				var txt = document.createTextNode( this.d.bigclass[k] );
			}
			tds[i].title = this.d.bigclass[k];
			tds[i].appendChild( txt );
			this.bindEvent( tds[i] , 'click' , tds[i].clickfunc = this.getFunc( this , this.clickLayer , [k,tds[i]] ) );
			++i;
		}
	};
	//显示大类
	pt.showLayer = function(){
		this.setProps( this.Container , {style:{display:'block'}} );
		this.p.showNode = this.p.showNode ? this.p.showNode : this.p.openNode;
		var pos = this.getPos( this.p.showNode ),
		l = pos.left,
		t = pos.top + this.p.showNode.offsetHeight;
		if( this.p.levelalign ){
			switch( this.p.levelalign ){
				case 'left':l = pos.left;break;
				case 'right':l = pos.left + this.p.showNode.offsetWidth - this.Container.offsetWidth;break;
				case 'center':l = pos.left + ( this.p.showNode.offsetWidth - this.Container.offsetWidth ) / 2;break;
			}
		}
		if( this.p.verticalalign ){
			switch( this.p.verticalalign ){
				case 'top':t = pos.top - this.Container.offsetHeight;break;
				case 'bottom':t = pos.top + this.p.showNode.offsetHeight;break;
				case 'middle':t = pos.top - ( this.Container.offsetHeight - this.p.showNode.offsetHeight ) / 2;break;
			}
		}
		this.setPosX( this.Container , l );
		this.setPosY( this.Container , t );
	};
	//大类点击
	//bigcode		大类编号
	//td				点击的td
	pt.clickLayer = function( bigcode , td ){
		if( this.p.NeedSubLayer ){//显示子层
			if( !this.SubContainer ){
				this.SubContainer = document.createElement( 'div' );//定位层
				this.appendEle( this.p.appendNode ? this.p.appendNode : document.body , this.SubContainer );
				this.SubContainer.className = this.p.SubContainerClassName ? this.p.SubContainerClassName : 'sublaycontainer';
				this.bindEvent( this.SubContainer , 'mouseout' , this.getFunc( this , this.setSubLayerClose ) );
				this.bindEvent( this.SubContainer , 'mouseover' , this.getFunc( this , this.setSubLayerOpen ) );
			}
			this.emptyEle( this.SubContainer );
			var subdata = this.getSubData( this.d.subclass , bigcode ),
			subLayer = this.createSubLayer( subdata , td );
			this.appendEle( this.SubContainer , subLayer );
			this.fillSubLayer( subdata );
			this.showSubLayer( td );
		}else{
			if( this.p.IsMulti ){
				if( td.childNodes[0].checked ){
					td.childNodes[0].checked = false;
					this.removeSelectedOption( bigcode );
				}else{
					if( this._SelOpt.length == this.p.MaxNumber ){
						this.alert({title:'控制面板',alertstr:'最多只能选择' + this.p.MaxNumber + '项 ',btnstr:'确定'});
						return;
					}
					td.childNodes[0].checked = true;
					this._SelOpt.push( bigcode );
				}
				this.fillSelectedOption();
			}else{
				this.p.viewNode ? this.p.viewNode.value = this.getLayerValue( bigcode , true ) : '';//显示内容
				this.p.valueNode ? this.p.valueNode.value = bigcode : '';//值
				this.hideLayer();
			}
		}
	};
	//填充小类
	//subclass	小类数据
	pt.fillSubLayer = function( subclass ){
		var tds = this.SubContainer.childNodes[0].td;
		for( var i = 0 ; i < tds.length ; ++i ){
			this.emptyEle( tds[i] );
			tds[i].removeAttribute( 'title' );
			tds[i].clickfunc ? this.removeEvent( tds[i] , 'click' , tds[i].clickfunc ) : '';
		}
		i = 0;
		for( var k in subclass ){
			if( this.p.IsMulti ){
				var chx = document.createElement( 'input' );
				chx.type = 'checkbox';
				chx.value = k;
				chx.onclick = this.getFunc( this , this.returnChx , chx );
				chx.className = this.p.ChkboxClassName ? this.p.ChkboxClassName : 'chxbox';
				tds[i].appendChild( chx );
				for( var m = 0 ; m < this._SelOpt.length ; ++m ){
					if( this._SelOpt[m] == k ){
						chx.checked = true;
						break;
					}
				}
			}
			var txt;
			if( this.p.SubstrLength ){
				txt = document.createTextNode( subclass[k].substringPro( this.p.SubstrLength ) );
			}else{
				txt = document.createTextNode( subclass[k] );
			}
			tds[i].title = subclass[k];
			tds[i].appendChild( txt );
			this.bindEvent( tds[i] , 'click' , tds[i].clickfunc = this.getFunc( this , this.clickSubLayer , [k,tds[i]] ) );
			++i;
		}
	};
	//显示小类
	//td	定位的td
	pt.showSubLayer = function( td ){
		this.setProps( this.SubContainer , {style:{display:'block'}} );
		var pos = this.getPos( td );
		this.setPosX( this.SubContainer , pos.left + 5 );
		this.setPosY( this.SubContainer , pos.top + 5 );
	};
	//小类点击
	//code	小类编号
	//td		点击的td
	pt.clickSubLayer = function( code , td ){
		if( this.p.IsMulti ){
			if( td.childNodes[0].checked ){
				td.childNodes[0].checked = false;
				this.removeSelectedOption( code );
			}else{
				var tmpSelOpt = this._SelOpt.clone();
				this._SelOpt.push( code );
				if( 4 == code.length ){
					this.removeSelectedOption( code.substr( 0 , 2 ) );
					var subdata = this.getSubData( this.d.subclass , code.substr( 0 , 2 ) );
					this.fillSubLayer( subdata );
				}
				if( 2 == code.length ){
					var subdata = this.getSubData( this.d.subclass , code );
					for( var k  in subdata ){
						this.removeSelectedOption( k );
					}
					this._SelOpt.push( code );
					this.fillSubLayer( subdata );
				}
				if( this._SelOpt.length > this.p.MaxNumber ){
					this.alert({title:'控制面板',alertstr:'最多只能选择' + this.p.MaxNumber + '项 ',btnstr:'确定'});
					this._SelOpt = tmpSelOpt.clone();
					td.childNodes[0].checked = false;
					return false;
				}
				td.childNodes[0].checked = true;
			}
			this.fillSelectedOption();
			this.fillLayer();
		}else{
			this.p.viewNode.value = this.getLayerValue( code , true );
			this.p.valueNode.value = code;
			this.hideLayer();
		}
	};
	//清空
	pt.clearSelect = function(){
		this._SelOpt = [];
		this.fillSelectedOption();
		this.fillLayer();
		this.p.viewNode.value = '';//显示内容
		this.p.valueNode ? this.p.valueNode.value = '' : '';//值
	};
	//确定
	pt.confirmSelect = function(){
		var codes = '',values = '';
		for( var i = 0 ; i < this._SelOpt.length ; ++i ){
			codes += ',' + this._SelOpt[i];
			values += ',' + this.getLayerValue( this._SelOpt[i] , true );
		}
		this.p.viewNode.value = values ? values.substr( 1 ) : '';
		this.p.valueNode.value = codes ? codes.substr( 1 ) : '';
		this.hideLayer();
	};
	//关闭
	pt.hideLayer = function(){
		this.setProps( this.Container , {style:{display:'none'}} );
		if( this.SubContainer ){
			this.setProps( this.SubContainer , {style:{display:'none'}} );
		}
	};
	//标示子层
	pt.setSubLayerOpen = function(){
		if( this.SubContainer ){
			this.SubContainer.show = true;
		}
	};
	//关闭子层
	pt.setSubLayerClose = function(){
		if( this.SubContainer ){
			this.SubContainer.show = false;
			setTimeout( this.getFunc( this , this.hideSubLayer ) , 50 );
		}
	};
	//延时查看是否该关闭
	pt.hideSubLayer = function(){
		if( !this.SubContainer.show ){
			this.setProps( this.SubContainer , {style:{display:'none'}} );
		}
	};
	//从选项中删除某个选项
	//code	需要删除的编号
	pt.removeSelectedOption = function( code ){
		var needOpt = [];
		for( var i = 0 ; i < this._SelOpt.length ; ++i ){
			if( this._SelOpt[i] != code ){
				needOpt.push( this._SelOpt[i] );
			}
		}
		this._SelOpt = needOpt;
	};
	//获取子类数据
	//data			子类json
	//bigcode		大类编号
	pt.getSubData = function( data , bigcode ){
		var subdata = {};
		if( this.p.SelectBig ){
			subdata[bigcode] = this.getLayerValue( bigcode );
		}
		for( var k in data ){
			if( k.substr( 0 , 2 ) == bigcode ){
				subdata[k] = data[k];
			}
		}
		return subdata;
	};
	//获取数据字典内容
	//code		编号
	//ifjoin	当获取小类数据时是否需要在前面添加大类
	pt.getLayerValue = function( code , ifjoin ){
		if( this.d.subclass ){
			if( 2 == code.length ){//大类
				return this.getDictData( code , this.d.bigclass );
			}else{
				if( ifjoin ){
					return this.getDictData( code.substr( 0 , 2 ) , this.d.bigclass ) + this.getDictData( code , this.d.subclass );
				}else{
					return this.getDictData( code , this.d.subclass );
				}
			}
		}else{
			return this.getDictData( code , this.d.bigclass );
		}
	};
	//阻止事件冒泡
	//chkbox	控件
	pt.returnChx = function( chkbox ){
		chkbox.checked = !chkbox.checked;
	};
})();